package com.lcxw.hxzbapi.dao.mapper;
import	java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.lcxw.hxzbapi.entity.pojo.Cube;

@Component
@Mapper
@Service
public interface CubeMapper {


    @Delete({
        "delete from ywpd_cube",
        "where `id` = #{id}"
    })
    int deleteByPrimaryKey(Integer id) throws Exception;


    @Insert({
        "insert into ywpd_cube (`giftId`,`giftName`, `url`, ",
        "`odds`,type, isBaodeng, enable)",
        "values (#{giftId}, #{giftName}, #{url}, ",
        "#{odds},#{type},#{isBaodeng}, #{enable})"
    })
    int insert(Cube cube)throws Exception;

    @Select({
        "select",
        "* from ywpd_cube",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    Cube selectByPrimaryKey(Integer id)throws Exception;


    @Select({"SELECT * FROM ywpd_cube WHERE type = #{type} AND enable = 1"})
    List<Cube> selectByType(String type);

    @Select({"SELECT * FROM ywpd_cube ORDER BY type ASC"})
    List<Cube> selectAll();


    @Update({
        "update ywpd_cube",
        "set `giftId` = #{giftId},",
        "`giftName` = #{giftName},",
        "`url` = #{url},",
        "`odds` = #{odds},",
        "`type` = #{type},",
        "`isBaodeng` = #{isBaodeng},",
        "enable = #{enable} ",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Cube cube)throws Exception;

}
